<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateStoreSeckillsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('store_seckills', function (Blueprint $table) {
            $table->id()->comment('商品秒杀表');
            $table->integer('product_id')->comment('商品ID')->index();
            $table->string('recommend_image')->comment('推荐图');
            $table->string('introduction')->comment('简介');
            $table->decimal('price',10,2)->comment('秒杀价格');
            $table->json('rotation_chart')->comment('轮播图');
            $table->string('title')->comment('活动标题');
            $table->decimal('cost',8,2)->comment('成本价格');
            $table->decimal('original_price',10,2)->comment('原价');
            $table->decimal('give_integral',10,2)->nullable()->comment('返多少积分');
            $table->integer('sort')->default(0)->comment('排序');
            $table->integer('stock')->default(0)->comment('库存');
            $table->integer('sales')->default(0)->comment('销量');
            $table->string('unit_name',10)->default('件')->comment('单位名称');
            $table->decimal('postage',8,2)->comment('邮费');
            $table->text('description')->comment('内容');
            $table->timestamp('start_time')->comment('开始时间');
            $table->timestamp('stop_time')->comment('结束时间');
            $table->integer('num')->default(0)->comment('最多秒杀几个');
            $table->integer('time_id')->default(1)->comment('时间段ID')->index();
            $table->integer('once_num')->default(1)->comment('单次购买个数');
            $table->integer('temp_id')->default(0)->comment('运费模板ID')->index();
            $table->decimal('weight',8,2)->nullable()->comment('商品重量');
            $table->decimal('volume',8,2)->nullable()->comment('商品体积');
            $table->integer('quota')->default(1)->comment('限购总数');
            $table->tinyInteger('is_show')->default(0)->comment('是否显示 0 不显示 1显示');
            $table->integer('quota_show')->default(1)->comment('限购总数显示 ');
            $table->integer('atr_status')->default(1)->comment('活动状态 0不开启 1开启 ');
            $table->string('status')->default('noCompleted')->comment('状态 haveInHand：进行中 completed:已结束 noCompleted:未开始');
            $table->tinyInteger('is_postage')->default(0)->comment('是否包邮 0否 1 是');
            $table->tinyInteger('is_hot')->default(0)->comment('是否推荐 0不推荐 1推荐');
            $table->softDeletes();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('store_seckills');
    }
}
